<?php

require_once 'FContainer.class.php';
require_once 'FImage.class.php';
require_once 'FLabel.class.php';

class FActionIcon extends FContainer
{
    
    private $handler;
    
    private $fieldImg;
    private $fieldLabel;
    
    public function __construct($name, $text, $handler, $image, $width = 64, $height = 64)
    {
        parent::__construct($name, FLayout::VERTICAL_LAYOUT);

        $this->fieldImg = new FImage('img_' . $name, $image);
        $this->fieldImg->setBaseCls('x-btn');
        $this->fieldLabel = new FLabel('lbl_' . $name, $text);
        $this->fieldLabel->setBaseCls('desktopActionLabel');
        
        $this->setOnClick($handler);
        
        $this->setWidth($width);
        $this->setHeight($height);
        
        $this->addItem($this->fieldImg);
        $this->addItem($this->fieldLabel);
    }
    
    public function setWidth($width)
    {
        $this->fieldImg->setWidth($width);
        $this->fieldLabel->setWidth($width);
        
        parent::setWidth($width);
    }
    
    public function setHeight($height)
    {
        $this->fieldImg->setHeight($height);
        
        parent::setHeight($height);
    }
        
}


?>
